package com.test.java;

import java.util.Scanner;

/**
 * “十七个银西可(Sickle)兑一个加隆(Galleon)，二十九个纳特(Knut)兑一个西可，很容易。”
 * 现在，给定哈利应付的价钱P和他实付的钱A，你的任务是写一个程序来计算他应该被找的零钱。
 * =============================================================
 * Version          Author          Date            Description
 * 1.0              白建         2017/12/29             创建
 * =============================================================
 */
public class Java_28
{

    public static void main(String[] args)
    {

        Scanner scanner = new Scanner(System.in);
        String temp = scanner.nextLine();
        String[] strings = temp.split(" |\\.");

        Long pay = Long.parseLong(strings[5]) + Long.parseLong(strings[4]) * 29 + Long.parseLong(strings[3]) * 17 * 29;
        Long price =
                Long.parseLong(strings[2]) + Long.parseLong(strings[1]) * 29 + Long.parseLong(strings[0]) * 17 * 29;
        Long returnMoney = pay - price;

        Long galleon = returnMoney / (17 * 29);
        Long sickle = (returnMoney - (galleon * 17 * 29)) / 29;
        Long knut = returnMoney - (galleon * 17 * 29 + sickle * 29);

        if (returnMoney < 0)
        {
            System.out.println(galleon + "." + Math.abs(sickle) + "." + Math.abs(knut));
        }
        else
        {
            System.out.println(galleon + "." + sickle + "." + knut);
        }
    }
}
